<?php
//echo phpinfo();

if ($handle = opendir('\wamp\www\MonSite\apps\frontend\config')) {
    echo "Directory handle: $handle\n";
    echo "Files:\n";

    /* This is the correct way to loop over the directory. */
    while (false !== ($file = readdir($handle))) {
        echo "$file\n";
    }

    closedir($handle);
}

if ($handle = opendir('\wamp\www\MonSite\apps\frontend\config')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            echo "$file\n";
        }
    }
    closedir($handle);
}

$a->var11 = "J'TM";
$test1 = $a;
$test2 = &$a;
$a = null;

var_dump($a); //null
var_dump($test1); //J'TM
var_dump($test2); //null

function foo(&$var)
{
    $var++;
}

$a=5;
foo($a); echo $a; // a=6

class foo {
    public $value = 42;

    public function &getValue() {
        return $this->value;
    }
}

$obj = new foo;
$myValue = &$obj->getValue(); 
echo $myValue;  //// $myValue is a reference to $obj->value, which is 42.
$obj->value = 2;
echo $myValue; 

$a = 1;
$b =& $a;
unset($a); echo $b;

echo $_SERVER["QUERY_STRING"];

$url = $sf_request->getPathInfo();
$Complete = $sf_request->getUri();
var_dump($url);
var_dump($Complete);
$path = parse_url($Complete);

echo($path['path'] . "  --  ");

//var_dump($form);
//var_dump($author);
//var_dump($news);



echo link_to('Go twitter!', "@Twitter");

echo link_to('Go Mongo!','cv/mongo');

//echo "Hmmmm im the first record in table:" . $author->getName() . " ---" . $author->getAge() . "</br>";
//
//foreach ($news as $value) {
//    echo "Hi,I'm order by age, my age is " . $value->getAge() . " and my name is " . $value->getName() . "</br>";
//}
?>

<?php
$keys = range(10, 20);
$results = array_combine($keys, $keys);

var_dump($results)
?>

<?php echo $authorform->renderFormTag('/frontend_dev.php/CV/table') ?>



<fieldset>
    <legend>Example form legend</legend>
    <?php echo $authorform['_csrf_token']->render(); ?>
    <?php foreach ($authorform as $field): ?>
        <?php if (!$field->isHidden()): ?>
            <div class="clearfix">
                <?php echo $field->renderLabel() ?>
                <div class="input">
                    <?php echo $field->render() ?>
                </div>
            </div>
        <?php endif; ?>
    <?php endforeach; ?>
    <div class="clearfix">
        <div class="input">
            <input type="submit" value="Funyyyyy"/>
        </div>
    </div>
</fieldset>
</form>

<?php 
///////__string()
class TestClass
{
    public $foo;

    public function __construct($foo)
    {
        $this->foo =$foo;
    }

    public function __toString()
    {
        return $this->foo;
    }
}

$class = new TestClass('Hello');
echo $class; 
//var_dump($class);

    class cat {
         public function __toString() {
             return "This is a cat\n"."dkkkk";
         }
     }

     $toby = new cat;
     print $toby;
     /////////__get()
    class dog {
         public $Name;
         public $DogTag;
         // public $Age;

         public function __get($var) {
             print "Attempted to retrieve $var and failed...\n haha";
         }
     }
     $poppy = new dog;
     print $poppy->Age;
?>




